<%--
  Created by GHW.
  Date: 2019/12/17
  Time: 9:50
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>游戏列表</title>
    <%--    绝对路径，防止丢失样式--%>
    <c:set value="${pageContext.request.contextPath}" var="ctx"/>
    <link rel="stylesheet" href="${ctx}/css/bootstrap.css" type="text/css">
    <%--    主样式--%>
    <link rel="stylesheet" href="${ctx}/css/gameStyle2.css" type="text/css">
    <link rel="stylesheet" href="${ctx}/css/Pagination.css" type="text/css">

    <link href="assets/css/lib/font-awesome.min.css" rel="stylesheet" type="text/css" >
    <link href="assets/css/lib/themify-icons.css" rel="stylesheet" type="text/css">
    <link href="assets/css/lib/owl.carousel.min.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/lib/owl.theme.default.min.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/lib/weather-icons.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/lib/mmc-chat.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/lib/sidebar.css" rel="stylesheet" type="text/css">
    <link href="assets/css/lib/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="assets/css/lib/simdahs.css" rel="stylesheet" type="text/css">
    <link href="assets/css/style.css" rel="stylesheet" type="text/css">

</head>
<body>

<div class="sidebar sidebar-hide-to-small sidebar-shrink sidebar-gestures">
    <div class="nano">
        <div class="nano-content">
            <ul>
                <li class="label">主页</li>
                <li ><a href="admin.jsp"><i class="ti-home"></i> 控制面板 </a></li>
                <li ><a href="userList.html"><i class="ti-user"></i> 用户管理</a></li>
                <li class="active"><a href="findAllGameByPage"><i class="ti-palette"></i> 游戏管理</a></li>
                <li ><a href="comments.html"><i class="ti-pencil-alt"></i> 评论管理</a></li>
                <li ><a href="findAllLibraryByPage"><i class="ti-user"></i> 用户游戏库管理</a></li>
                <li ><a href="articleList.html"><i class="ti-book"></i> 文章管理</a></li>
            </ul>
        </div>
    </div>
</div>




<div class="header">
    <div class="pull-left">
        <div class="logo" id="sideLogo">
            <a href="index.html">
                <img class="full-logo" src="assets/images/logo-big.png" alt="SimDahs">
                <img class="small-logo" src="assets/images/logo-small.png" alt="SimDahs">
            </a>
        </div>
        <div class="hamburger sidebar-toggle">
            <span class="ti-menu"></span>
        </div>
    </div>

    <div class="pull-right p-r-15">
        <ul>



            <li class="header-icon dib"><img class="avatar-img" src="assets/images/avatar/1.jpg" alt="" /> <span class="user-avatar">王德发 <i class="ti-angle-down f-s-10"></i></span>

            </li>
        </ul>
    </div>
</div>




<%--<div style="width: 75%;padding-top: 150px; padding-left: 300px">--%>
<div class="container-fluid" style="width: 80% ;margin: 0 auto 0 300px;padding-top: 50px;">
<%--主体表单--%>
<form action="findAllGameByPage" method="post">
    <%--    主体开始--%>
    <div  ><br>
        <h1>后台：游戏列表</h1></div>
    <table class="table-fill">
        <thead>
        <%--        表头--%>
        <tr>
            <th class="text-center">预览图</th>
            <th class="text-center">游戏名</th>
            <th class="text-center">原价</th>
            <th class="text-center">打折价</th>
            <th class="text-center">开发商</th>
            <th class="text-center">运行平台</th>
            <th class="text-center">游戏标签</th>
            <th class="text-center">描述</th>
            <th class="text-center" colspan="2">操作</th>
        </tr>
        </thead>
        <tbody class="table-hover">
        <%--        表数据遍历开始--%>
        <c:forEach items="${page.list}" var="game">
            <tr>
                <td class="text-center"><img src="${ctx}/img/gameImg/${game.img}" alt="${game.img}"
                                             style="height: 200px;width: 300px;"></td>
                <td class="text-center">${game.name}</td>
                <td class="text-center">${game.price}</td>
                <td class="text-center">${game.discountprice}</td>
                <td class="text-center">${game.developer}</td>
                <td class="text-center">${game.platform}</td>
                <td class="text-center">${game.tag}</td>
                <td class="text-center">${game.description}</td>
                <td class="text-center" colspan="2">
                    <button class="btn btn-danger">
                        <a href="deleteGame?id=${game.id}" class="btn-danger">删除</a></button>
                    <br><br><br>
                    <button class="btn btn-success">
                        <a href="updateInfo?id=${game.id}" class="btn-success">修改</a>
                    </button>
                </td>
            </tr>
        </c:forEach>
        <%--        遍历结束--%>
        <%--        添加游戏 样式--%>
        <tr>
            <td colspan="10" align="center">
                <a href="gameAdd.jsp" style="color: red">添加新游戏</a>
            </td>
        </tr>
        <%--    Pagination Start 分页开始--%>
        <tr>
            <td colspan="10">
                <div class="container">
                    <div class="row pad-15">
                        <div class="col-md-12">
                            <nav class="pagination-outer" aria-label="Page navigation">
                                <ul class="pagination">
                                    <c:choose>
                                        <%--第一页--%>
                                        <c:when test="${page.pageNum == 1}"/>
                                        <%--非第一页，显示 首页、上一页--%>
                                        <c:otherwise>
                                            <li class="page-item">
                                                <a href="findAllGameByPage?pageNum=1" class="page-link"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true">首页</span>
                                                </a>
                                            </li>
                                            <li class="page-item">
                                                <a href="findAllGameByPage?pageNum=${page.prePageNum}" class="page-link"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true">&laquo;</span>
                                                </a>
                                            </li>
                                        </c:otherwise>
                                    </c:choose>
                                    <%--显示当前页--%>
                                    <li class="page-item">
                                        <a href="findAllGameByPage?pageNum=${page.pageNum}"
                                           class="page-link">${page.pageNum}</a>
                                    </li>

                                    <c:choose>
                                        <%-- 如果是尾页，只显示当前页码 --%>
                                        <c:when test="${page.pageNum == page.totalPageNum}"/>
                                        <%-- 如果不是尾页，显示当前页和下一页的页码 --%>
                                        <c:otherwise>
                                            <li class="page-item">
                                                <a href="findAllGameByPage?pageNum=${page.nextPageNum}"
                                                   aria-label="Next"
                                                   class="page-link">
                                                    <span aria-hidden="true">&raquo;</span>
                                                </a>
                                            </li>
                                            <li class="page-item">
                                                <a href="findAllGameByPage?pageNum=${page.totalPageNum}" class="page-link"
                                                   aria-label="Previous">
                                                    <span aria-hidden="true">尾页</span>
                                                </a>
                                            </li>
                                        </c:otherwise>
                                    </c:choose>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
        <%-- Pagination End--%>
        </tbody>
    </table>

</form>

</div>

<script src="${ctx}/js/jquery-3.4.1.min.js"></script>
<script src="${ctx}/js/bootstrap.js"></script>

<script type="text/javascript" src="assets/js/lib/jquery.min.js"></script><!-- jquery vendor -->
<script type="text/javascript" src="assets/js/lib/jquery.nanoscroller.min.js"></script><!-- nano scroller -->
<script type="text/javascript" src="assets/js/lib/sidebar.js"></script><!-- sidebar -->
<script type="text/javascript" src="assets/js/lib/bootstrap.min.js"></script><!-- bootstrap -->
<script type="text/javascript" src="assets/js/lib/mmc-common.js"></script>
<script type="text/javascript" src="assets/js/lib/mmc-chat.js"></script>
<!--  Chart js -->
<script type="text/javascript" src="assets/js/lib/chart-js/Chart.bundle.js"></script>
<script type="text/javascript" src="assets/js/lib/chart-js/chartjs-init.js"></script>
<!-- // Chart js -->


<script src="assets/js/lib/sparklinechart/jquery.sparkline.min.js"></script><!-- scripit init-->
<script src="assets/js/lib/sparklinechart/sparkline.init.js"></script><!-- scripit init-->

<!--  Datamap -->
<script src="assets/js/lib/datamap/d3.min.js"></script>
<script src="assets/js/lib/datamap/topojson.js"></script>
<script src="assets/js/lib/datamap/datamaps.world.min.js"></script>
<script src="assets/js/lib/datamap/datamap-init.js"></script>
<!-- // Datamap -->
<script src="assets/js/lib/weather/jquery.simpleWeather.min.js"></script>
<script src="assets/js/lib/weather/weather-init.js"></script>
<script src="assets/js/lib/owl-carousel/owl.carousel.min.js"></script>
<script src="assets/js/lib/owl-carousel/owl.carousel-init.js"></script>
<script src="assets/js/scripts.js"></script>
</body>
</html>
